home *** CD-ROM | disk | FTP | other *** search
- class FPUI.Component extends MovieClip
- {
- var controller;
- static var focusedComponent = null;
- var m_width = 0;
- var m_height = 0;
- var m_enable = true;
- var m_focused = false;
- var m_handlerObj = null;
- var m_changeHandler = "";
- var m_methodTable = null;
- var m_keyListener = null;
- var m_eatsNavKeysWhenFocused = false;
- static var kHiliteColor = 4290117529;
- static var kRolloverColor = 4292542412;
- static var kWhiteBgColor = 4294967295;
- function Component()
- {
- var _loc1_ = this;
- var _loc2_ = _global;
- super();
- _loc1_.useHandCursor = false;
- _loc1_.tabChildren = false;
- _loc1_.tabEnabled = true;
- _loc1_.focusEnabled = true;
- _loc1_._focusrect = false;
- _loc1_._accImpl = new Object();
- _loc1_._accImpl.stub = true;
- _loc1_.m_width = _loc1_._width;
- _loc1_.m_height = _loc1_._height;
- _loc1_.m_methodTable = new Object();
- _loc1_.m_keyListener = new Object();
- _loc1_.m_keyListener.controller = _loc1_;
- _loc1_.m_keyListener.onKeyDown = function()
- {
- this.controller.onComponentKeyDown();
- };
- if(_loc2_.fpuiFocusControl == undefined)
- {
- _loc2_.fpuiFocusControl = new Object();
- _loc2_.fpuiFocusControl.onSetFocus = function(oldFocus, newFocus)
- {
- oldFocus.onComponentKillFocus();
- newFocus.onComponentSetFocus();
- FPUI.Component.focusedComponent = newFocus;
- };
- Selection.addListener(_loc2_.fpuiFocusControl);
- }
- }
- function setEnabled(enabledFlag)
- {
- var _loc1_ = this;
- var _loc2_ = enabledFlag;
- _loc1_.m_enable = _loc2_;
- _loc1_.tabEnabled = _loc2_;
- _loc1_.focusEnabled = _loc2_;
- if(!_loc1_.m_enable && _loc1_.m_focused)
- {
- Selection.setFocus(undefined);
- }
- }
- function getEnabled()
- {
- return this.m_enable;
- }
- function getFocused()
- {
- return this.m_focused;
- }
- function setSize(w, h)
- {
- this.m_width = w;
- this.m_height = h;
- }
- function setChangeHandler(chng, obj)
- {
- var _loc1_ = this;
- _loc1_.m_handlerObj = obj != undefined ? obj : _loc1_._parent;
- _loc1_.m_changeHandler = chng;
- }
- function invalidate(methodName)
- {
- var _loc1_ = this;
- _loc1_.m_methodTable[methodName] = true;
- _loc1_.onEnterFrame = _loc1_.cleanUI;
- }
- function cleanUI()
- {
- var _loc1_ = this;
- var _loc2_ = _loc1_.m_methodTable;
- _loc1_.m_methodTable = new Object();
- delete _loc1_.onEnterFrame;
- for(var _loc3_ in _loc2_)
- {
- _loc1_[_loc3_]();
- }
- }
- function pressFocus()
- {
- Selection.setFocus(this);
- }
- function onComponentSetFocus()
- {
- this.m_focused = true;
- Key.addListener(this.m_keyListener);
- }
- function onComponentKillFocus()
- {
- this.m_focused = false;
- Key.removeListener(this.m_keyListener);
- }
- function onComponentKeyDown()
- {
- }
- function executeCallBack()
- {
- var _loc1_ = this;
- _loc1_.m_handlerObj[_loc1_.m_changeHandler](_loc1_);
- }
- static function fillRect(mc, left, top, width, height, ca)
- {
- var _loc1_ = mc;
- var _loc3_ = top;
- var _loc2_ = ca >> 24;
- if(_loc2_ < 0)
- {
- _loc2_ += 256;
- }
- _loc2_ = _loc2_ * 100 / 255;
- var c = ca & 0xFFFFFF;
- _loc1_.beginFill(c,_loc2_);
- _loc1_.moveTo(left,_loc3_);
- _loc1_.lineTo(left + width,_loc3_);
- _loc1_.lineTo(left + width,_loc3_ + height);
- _loc1_.lineTo(left,_loc3_ + height);
- _loc1_.lineTo(left,_loc3_);
- _loc1_.endFill();
- }
- }
-